<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBookTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('book', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name', 255)->comment('书名');
            $table->string('cover', 255)->comment('封面');
            $table->string('intro', 255)->comment('简介');
            $table->integer('user_id')->comment('用户');
            $table->string('type_id', 255)->comment('分类组');
            $table->integer('view_num')->nullable()->default(0)->comment('点击数');
            $table->integer('like_num')->nullable()->default(0)->comment('点赞数');
            $table->integer('comment_num')->nullable()->default(0)->comment('评论数');
            $table->integer('share_num')->nullable()->default(0)->comment('分享数');
            $table->integer('collect_num')->nullable()->default(0)->comment('收藏数');
            $table->integer('is_top')->nullable()->default(0)->comment('是否置顶');
            $table->char('module_id', 11)->comment('模块标识:1小说;2漫画');
            $table->char('status', 1)->nullable()->default(1)->comment('状态:0删除;1待审核;2审核成功-连载中;3完本;4烂尾');
            $table->string('admin_id', 1)->default(0)->nullable()->comment('创建人');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('book');
    }
}
